#pragma once

#ifndef BUFFER_TYPE_FLAGS_HPP
#define BUFFER_TYPE_FLAGS_HPP

#include "../Platform.hpp"

namespace Buffer {

enum class BufferType {
  ARRAY_BUFFER,
  ELEMENT_ARRAY_BUFFER,
  UNIFORM_BUFFER,
  ATOMIC_BUFFER,
  READ_COPY_BUFFER,
  WRITE_COPY_BUFFER,
  SHADER_STORAGE_BUFFER,
  TRANSFORM_FEEDBACK_BUFFER,
  QUERY_BUFFER,
  DRAW_INDIRECT_BUFFER,
  PIXEL_PACK_BUFFER,
  PIXEL_UNPACK_BUFFER,
  // TODO: texture buffer has a different command
  TEXTURE_BUFFER,
  DISPATCH_INDIRECT_BUFFER,
};

inline static GLenum GetGLBufferType(BufferType type) {
  static GLenum table[] = {
      GL_ARRAY_BUFFER,          GL_ELEMENT_ARRAY_BUFFER,      GL_UNIFORM_BUFFER,
      GL_ATOMIC_COUNTER_BUFFER, GL_COPY_READ_BUFFER,          GL_COPY_WRITE_BUFFER,
      GL_SHADER_STORAGE_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER, GL_QUERY_BUFFER,
      GL_DRAW_INDIRECT_BUFFER,  GL_PIXEL_PACK_BUFFER,         GL_PIXEL_UNPACK_BUFFER,
      GL_TEXTURE_BUFFER,        GL_DISPATCH_INDIRECT_BUFFER};
  return table[static_cast<size_t>(type)];
}

} // namespace Buffer

#endif